{{@need/header}}
<style>
    .layui-btn{width: 80%;    margin: 20px 10%;}
</style>
<div class="head-title"><a class="fa fa-angle-left" href="javascript:history.go(-1)"></a>修改密码</div>
<div class="h-45"></div>
<div class="uphuoma layui-form">
    <div style=" width:94%; margin:30px auto;">
        <form class="layui-form layui-form-pane" id="updateform">

            <div class="layui-form-item">
                <label class="layui-form-label">原密码</label>
                <div class="layui-input-block">
                    <input type="password" name="oldpassword" placeholder="请输入原密码" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password"  placeholder="请输入新密码" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-block">
                    <input type="password" name="repassword" placeholder="请输入确认新密码" class="layui-input">
                </div>
            </div>
        </form>

        <div class="layui-form-item">
            <button class="layui-btn" type="button" onclick="submit()" style="background-color:#1E9FFF;">点击提交</button>
        </div>

    </div>

</div>
{{ $footer = 0}}
{{@need/footer}}
<script type="text/javascript">

    layui.use(['form', 'layedit'], function(){
        var form = layui.form
            ,layer = layui.layer;

    });

    function submit(){
        $.ajax({
            type: "POST",
            url: "{{:url('editPassAjax')}}",
            data: $("#updateform").serialize(),
            dataType: "json",
            success: function (result) {
                if (result.code == 200) {
                    layer.msg(result.msg,{icon:1,time:1000});
                    setTimeout(function() {
                        location = "{{:url('pass')}}";
                    },1000);
                } else {
                    layer.msg(result.msg);
                }
            }
        });


    }


</script>